﻿
    using Chain.BLL;
    using System;
    using System.Data;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public partial class promotions : Page
    {
        private DataTable dt = new MemLevel().GetList("").Tables[0];

        private Promotions PromotionsBll = new Promotions();


        protected string getEffectiveTime(object objPromotionsType, object objPromotionsStart, object objPromotionsEnd)
        {
            if (Convert.ToInt32(objPromotionsType) == 0)
            {
                return "永久有效";
            }
            return (Convert.ToDateTime(objPromotionsStart).ToString("yyyy-MM-dd") + "至" + Convert.ToDateTime(objPromotionsEnd).ToString("yyyy-MM-dd"));
        }

        protected string getMemberObj(object obj)
        {
            int PromotionsMemLevel = Convert.ToInt32(obj);
            if (PromotionsMemLevel == -1)
            {
                return "所有会员";
            }
            return this.dt.Select("LevelID=" + PromotionsMemLevel)[0]["LevelName"].ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dt = this.PromotionsBll.GetList("1=1 order by PromotionsID desc").Tables[0];
            this.rptPromotions.DataSource = dt;
            this.rptPromotions.DataBind();
            if (dt.Rows.Count == 0)
            {
                this.msg.Style.Add("display", "");
            }
        }
    }


